<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:p="http://primefaces.prime.com.tr/ui"      
      xmlns:ui="http://java.sun.com/jsf/facelets">


	<ui:composition template="/template/layout2.xhtml">
	<ui:define name="conteudo">
		<br/><br/>
		<div id="path">
			<h1>Cadastro Questoes</h1>
			<hr />
			
		</div>
		
		<h:form><br/><br/><br/>
		<p:messages autoUpdate="true"/>
		<fieldset>
		<legend>Dados</legend>
		<br /><br/>
		<h:panelGrid columns="3" >
			<h:outputLabel value="Enunciado:" for="enunciado" styleClass="label"/>
			<h:inputTextarea id="enunciado" style="width=40" value="#{questoesBean.questao.enunciado}" required="true" requiredMessage="* O campo [Enunciado] é obrigatório!"  />
			<br/>
			
			<h:outputLabel value="Alternativa 01:" for="alternativa1" styleClass="label"/>				
			<h:inputText id="alternativa1" class="rotulos" size="40" value="#{questoesBean.questao.opcao1}" required="false" />
			<br/>
			
			<h:outputLabel value="Alternativa 02:" for="alternativa2" styleClass="label"/>				
			<h:inputText id="alternativa2" class="rotulos" size="40" value="#{questoesBean.questao.opcao2}" required="false" />
			<br/>
			
			<h:outputLabel value="Alternativa 03:" for="alternativa3" styleClass="label"/>				
			<h:inputText id="alternativa3" class="rotulos" size="40" value="#{questoesBean.questao.opcao3}" required="false" />
			<br/>
			
			<h:outputLabel value="Alternativa 04:" for="alternativa4" styleClass="label"/>				
			<h:inputText id="alternativa4" class="rotulos" size="40" value="#{questoesBean.questao.opcao4}" required="false" />
			<br/>
			
			<h:outputLabel value="Alternativa 05:" for="alternativa5" styleClass="label"/>				
			<h:inputText id="alternativa5" class="rotulos" size="40" value="#{questoesBean.questao.opcao5}" required="false" />
			<br/>
			
			<h:outputLabel value="Alternativa 06:" for="alternativa6" styleClass="label"/>				
			<h:inputText id="alternativa6" class="rotulos" size="40" value="#{questoesBean.questao.opcao6}" required="false" />
			<br/>
			
			<h:outputLabel value="Resposta:" for="resposta" styleClass="label"/>				
			<h:inputText id="resposta" class="rotulos" size="40" value="#{questoesBean.questao.resposta}" />
			<br/>
				
	    </h:panelGrid>  
	    		<br /><br/>
	    		<h:commandButton class="botaolimpar" value="Limpar" image="../resources/imagens/botoes/botao-limpar.png" immediate="true">
				<f:ajax render="@form"></f:ajax>	
				</h:commandButton>	
	            <h:commandButton class="botaosalvar" value="Salvar" image="../resources/imagens/botoes/botao-salvar.png" action="#{questoesBean.actionCadastrar}" ></h:commandButton>	      		
		</fieldset>
		</h:form>
		<div><br/></div>
    	<h:form>
			<h:dataTable styleClass="tabela" headerClass="cabecalho" columnClasses="ultimo,primeiro"  id="basic" var="q" value="#{questoesBean.questoes}">
				<h:column>
					<f:facet name="header">  
		                 	Nome
		            </f:facet>
		            <h:outputText value="#{q.enunciado}" />		            
				</h:column>
				<h:column>
					<f:facet name="header">  
		                 	Ações
		            </f:facet>
					<h:commandLink value="" action="#{questoesBean.actionRemover}"
						title="Remover">
						<f:setPropertyActionListener target="#{questoesBean.questao}"
							value="#{q}" />
							<h:graphicImage library="imagens" name="ic_remover.gif" />
					</h:commandLink>
					<h:commandLink value="" title="Alterar">
						<f:setPropertyActionListener target="#{questoesBean.questao}"
							value="#{q}" />
							<h:graphicImage library="imagens" name="editar.png" />
					</h:commandLink>
				</h:column>
				
			</h:dataTable>
		</h:form>
		</ui:define>
	</ui:composition>
</html>